// Place your Spring DSL code here

import com.next.*

beans = {
    loginHistorySecurityEventListener(LoginHistorySecurityEventListener)
    userDetailsService(CustomUserDetailsService)
    preAuthenticationChecks(CustomPreAuthenticationChecks)
    authenticationDetailsSource(CustomWebAuthenticationDetailsSource)

    //    def conf = grailsApplication.config.springsession
    //    if (conf.redis.cluster.nodes) {
    //      List<Map> nodes = conf.redis.cluster.nodes as List<Map>
    //      redisClusterConfiguration(RedisClusterConfiguration) {
    //        clusterNodes = (nodes.collect { new RedisNode(it.host as String, it.port as Integer) }) as Set
    //      }
    //      redisConnectionFactory(JedisConnectionFactory, ref("redisClusterConfiguration")) {
    //        if (conf.redis.password) {
    //          password = conf.redis.password
    //        }
    //      }
    //    }

    customAuthenticationProvider(CustomAuthenticationProvider) {
        userDetailsService = ref('userDetailsService')
        passwordEncoder = ref('passwordEncoder')
        userCache = ref('userCache')
        saltSource = ref('saltSource')
        preAuthenticationChecks = ref('preAuthenticationChecks')
        postAuthenticationChecks = ref('postAuthenticationChecks')
        authoritiesMapper = ref('authoritiesMapper')
    }
    // daoAuthenticationProvider(CustomAuthenticationProvider)
}
// beans = {}
